package com.chanel.iamframework.core.dao;

import com.chanel.iamframework.core.domain.Application;

public interface ApplicationDAO {
	
	/**
	 * Persist Application entity
	 * @param application entity
	 * @return The number of rows affected by the insert
	 */
	int createApplication(Application application);
	
	/**
	 * Get Application by id
	 * @param applicationId Identity
	 * @return Application entity
	 */
	Application getApplication(Long applicationId);
	
	/**
	 * Update Application entity
	 * @param application entity
	 * @return The number of rows affected by the insert
	 */
    int updateApplication(Application application);
    
    /**
     * Delete application by identity
     * @param applicationId identity
     * @return The number of rows affected by the insert
     */
    int deleteApplication(Long applicationId);
    
    /**
     * Load Groups by applicationId into the returned {@link com.chanel.iamframework.core.domain.Application} instance.
     * @param applicationId identity
     * @return {@link com.chanel.iamframework.core.domain.Application} instance with list of {@link com.chanel.iamframework.core.domain.Group}
     */
	Application loadGroups(Long applicationId);

	/**
	 * Load Roles by applicationId into the returned {@link com.chanel.iamframework.core.domain.Application} instance.
	 * @param applicationId identity
	 * @return {@link com.chanel.iamframework.core.domain.Application} instance with list of {@link com.chanel.iamframework.core.domain.Role}
	 */
	Application loadRoles(Long applicationId);
	
	/**
	 * Load User by applicationId into the returned {@link com.chanel.iamframework.core.domain.Application} instance.
	 * @param applicationId identity
	 * @return {@link com.chanel.iamframework.core.domain.Application} instance with list of {@link com.chanel.iamframework.core.domain.User}
	 */
	Application loadUsers(Long applicationId);

	/**
	 * Add Aplpication, Group association
	 * @param applicationId identity
	 * @param groupId identity
	 * @return The number of rows affected by the insert
	 */
	int addGroup(Long applicationId, Long groupId);

	/**
	 * Delete Application, Group association
	 * @param applicationId identity
	 * @param groupId identity
	 * @return The number of rows affected by the insert
	 */
	int deleteGroup(Long applicationId, Long groupId);
}